import {createSelector} from '@ngrx/store';

// 获取整个state中的list
export const selectList = (state: any) => {
  return state.list;
}

// 获取list中的所有元素
export const selectAllItems = createSelector(
  selectList,
  (data) => data
);

// 获取list中的元素数量
export const selectItemCount = createSelector(
  selectList,
  (list) => list.length
);

// 获取list中第一个元素
export const selectFirstItem = createSelector(
  selectAllItems,
  (items) => items[0]
);
